<link href="<?php echo $this->getSkinUrl('Customerpartner/css/global.css'); ?>" rel="stylesheet" type="text/css" />
<link href="<?php echo $this->getSkinUrl('Customerpartner/css/webkul-image-slider.css'); ?>" rel="stylesheet" type="text/css" />
<script type="text/javascript">
if (typeof jQuery == 'undefined'){
    document.write(unescape("%3Cscript src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
<?php 
	$mediaurl=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
?>
<style>
.feedback-item .image {
    background: url("<?php echo $mediaurl.'avatar/noimage.png'; ?>") no-repeat scroll 0 0 #CCC;
	}
</style>
<div id="customer-reviews" class="box-collateral box-reviews">
	<div class="form-add">
	<?php if(strlen($_GET['result'])>2){ ?>
			 <center><p class="feedmsg"><img src="<?php echo $this->getSkinUrl('customerurlpic/savefeed.png');?>"/></p></center>
	<?php } ?>
	<?php if(Mage::getSingleton('customer/session')->isLoggedIn()) { ?>
		<center>
			<p class="givefeed">
				<a href="javascript:;"><img src="<?php echo $this->getSkinUrl('customerurlpic/givefeed.png'); ?>" /></a>
			</p>
		</center>
		<div class="showreview">	
			<h2><?php echo Mage::helper('marketplacepartner')->__('Write Your Own Feedback') ?></h2>
			<form id="review-form" method="post" action="<?php echo $this->getUrl('customer/products/newfeedback') ?>" enctype="multipart/form-data" >
				<fieldset>
					<h4><?php echo Mage::helper('marketplacepartner')->__('How do you rate this Store') ?>? <em class="required">*</em></h4>
					<span id="input-message-box"></span>
					<table id="product-review-table" class="data-table">
					<colgroup>
						<col>
						<col width="1">
						<col width="1">
						<col width="1">
						<col width="1">
						<col width="1">
					</colgroup>
					<thead>
						<tr class="first last">
							<th>&nbsp;</th>
							<th><span class="nobr">1 <?php echo Mage::helper('marketplacepartner')->__('star') ?></span></th>
							<th><span class="nobr">2 <?php echo Mage::helper('marketplacepartner')->__('stars') ?></span></th>
							<th><span class="nobr">3 <?php echo Mage::helper('marketplacepartner')->__('stars') ?></span></th>
							<th><span class="nobr">4 <?php echo Mage::helper('marketplacepartner')->__('stars') ?></span></th>
							<th><span class="nobr">5 <?php echo Mage::helper('marketplacepartner')->__('stars') ?></span></th>
						</tr>
					</thead>
					<tbody>
						<tr class="first odd">
							<th><?php echo Mage::helper('marketplacepartner')->__('Price') ?></th>
							<td class="value"><input type="radio" class="radio" value="20" id="Price_1" name="feedprice" checked="checked"/></td>
							<td class="value"><input type="radio" class="radio" value="40" id="Price_2" name="feedprice"></td>
							<td class="value"><input type="radio" class="radio" value="60" id="Price_3" name="feedprice"></td>
							<td class="value"><input type="radio" class="radio" value="80" id="Price_4" name="feedprice"></td>
							<td class="value last"><input type="radio" class="radio" value="100" id="Price_5" name="feedprice"></td>
						</tr>
						<tr class="even">
							<th><?php echo Mage::helper('marketplacepartner')->__('Value') ?></th>
							<td class="value"><input type="radio" class="radio" value="20" id="Value_1" name="feedvalue" checked="checked"/></td>
							<td class="value"><input type="radio" class="radio" value="40" id="Value_2" name="feedvalue"></td>
							<td class="value"><input type="radio" class="radio" value="60" id="Value_3" name="feedvalue"></td>
							<td class="value"><input type="radio" class="radio" value="80" id="Value_4" name="feedvalue"></td>
							<td class="value last"><input type="radio" class="radio" value="100" id="Value_5" name="feedvalue"></td>
						</tr>
						<tr class="last odd">
							<th><?php echo Mage::helper('marketplacepartner')->__('Quality') ?></th>
							<td class="value"><input type="radio" class="radio" value="20" id="Quality_1" name="feedquality" checked="checked"/></td>
							<td class="value"><input type="radio" class="radio" value="40" id="Quality_2" name="feedquality"></td>
							<td class="value"><input type="radio" class="radio" value="60" id="Quality_3" name="feedquality"></td>
							<td class="value"><input type="radio" class="radio" value="80" id="Quality_4" name="feedquality"></td>
							<td class="value last"><input type="radio" class="radio" value="100" id="Quality_5" name="feedquality"></td>
						</tr>
					</tbody>
					</table>
					<?php 
							$loggeduserid=Mage::getSingleton('customer/session')->getCustomer()->getEntityid();
							$storeproownerid=$_GET['id'];
							$loggedcustomer = Mage::getModel('customer/customer')->load($loggeduserid); 
					?>
					<input type="hidden" class="userid" name="userid" id="userid" value="<?php echo $loggeduserid; ?>" title="userid"/>
					<input type="hidden" class="useremail" name="useremail" id="useremail" value="<?php echo $loggedcustomer['email']; ?>" title="useremail"  />
					<input type="hidden" class="proownerid" name="proownerid" id="proownerid" value="<?php echo $_GET['id']; ?>" title="proownerid"/>
					<input type="hidden" class="createdat" name="createdat" id="createdat" value="<?php echo date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())); ?>" title="createdat"/>
					<script type="text/javascript">decorateTable('product-review-table')</script>
								<ul class="form-list">
						<li>
							<label class="required" for="nickname_field"><em>*</em><?php echo Mage::helper('marketplacepartner')->__('Nickname') ?></label>
							<div class="input-box">
								<input type="text" value="<?php  echo $loggedcustomer['nickname']; ?>" class="input-text required-entry widthinput nickname" id="nickname_field" name="feednickname">
							</div>
						</li>
						<li>
							<label class="required" for="summary_field"><em>*</em><?php echo Mage::helper('marketplacepartner')->__('Summary of Your Review') ?></label>
							<div class="input-box">
								<input type="text" value="" class="input-text required-entry widthinput summary_field" id="summary_field" name="feedsummary">
							</div>
						</li>
						<li>
							<label class="required" for="review_field"><em>*</em><?php echo Mage::helper('marketplacepartner')->__('Review') ?></label>
							<div class="input-box">
								<textarea class="required-entry widthinput review_field" rows="3" cols="5" id="review_field" name="feedreview"></textarea>
							</div>
						</li>
					</ul>
				</fieldset>
				<div class="buttons-set">
					<button class="button" title="<?php echo Mage::helper('marketplacepartner')->__('Submit Review') ?>" type="submit"><span><span><?php echo Mage::helper('marketplacepartner')->__('Submit Review') ?></span></span></button>
				</div>
		</form>
	</div>
	<?php } else { ?>
			<?php Mage::getSingleton('customer/session')->setAfterAuthUrl(Mage::helper("core/url")->getCurrentUrl());?>
			 <center><p class="loginmsg"><a href="<?php echo $this->getUrl('customer/account/loginPost/') ?>"><img src="<?php echo $this->getSkinUrl('customerurlpic/logintofeed.png'); ?>" /></a></p></center>
		 <?php } ?>  
    </div>
</div>

<div class="feedbacklist">
	<?php $feedlist=Mage::getModel('marketplacepartner/feedback')->getFeedList($_GET['id']); ?>
	<div class="feedback-list">
		<?php foreach($feedlist as $keyed){ ?>	
			<div class="feedback-item">
				<!--div class="image"><img class="bannerpicrs" src="<?php //echo $mediaurl.'avatar/'.$keyed['userid'].'_120_120_small.jpg'; ?>" /></div-->
				<div class="feedback">
					<div class="price">
						<h2><?php echo Mage::helper('marketplacepartner')->__('Price') ?> :</h2>
						<div class="ratingslider-box">
							<div class="rating" style="width:<?php echo ceil($keyed['feedprice']);?>%;"></div>
						</div>
						<div style="clear:both;"></div>
					</div>
					<div class="value">
						<h2><?php echo Mage::helper('marketplacepartner')->__('Value') ?> :</h2>
						<div class="ratingslider-box" >
							<div class="rating" style="width:<?php echo ceil($keyed['feedvalue']);?>%;"></div>
						</div>
						<div style="clear:both;"></div>
					</div>
					<div class="quality">
						<h2><?php echo Mage::helper('marketplacepartner')->__('Quality') ?> :</h2>
						<div class="ratingslider-box">
							<div class="rating" style="width:<?php echo ceil($keyed['feedquality']);?>%;"></div>
						</div>
						<div style="clear:both;"></div>
					</div>
				</div>
				<div class="buyer">
					<?php echo Mage::helper('marketplacepartner')->__('FeedBack By') ?> 
					<span>
						<?php 
							$feedcustomer = Mage::getModel('customer/customer')->load($keyed['userid']); 
							echo $feedcustomer['firstname'].' '.$feedcustomer['lastname'];  
						?>
					</span>
				</div>
				<div class="date"><?php echo Mage::helper('marketplacepartner')->__('Date') ?> <span><?php echo $keyed['createdat']; ?></span></div>
				<div class="RATING"><span title="" class="icon icon-fbk-pos hastip tooltipsy-init"></span></div>
				<div class="comment"><?php echo $keyed['feedreview']; ?> </div>
			</div>
		<?php } ?>
	</div>
</div>
<script type="text/javascript">
	jQuery.noConflict();	
	 jQuery(".givefeed").click(function () {
		jQuery(".givefeed").hide();
		jQuery(".feedmsg").parent().hide()
		jQuery('.showreview').show();
    });
	jQuery('#review-form').submit(function(){
		var flag=0;
		jQuery('#review-form input,#review-form textarea').each(function(){
			if(jQuery(this).val()==''){
				flag++;	
			}
		});
		if(flag!=0){
			alert("<?php echo Mage::helper('marketplacepartner')->__('fill the required fields') ?>");
			return false;
		}	
	});	
    </script>